﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:TouchControls"
    >
    <BitmapImage x:Key="ImgMenu">/TouchControls;component/Icons/MB_0026_taskmgrx32.png</BitmapImage>
    <Style TargetType="{x:Type local:TouchMenu}">
        <Setter Property="Icon" Value="{StaticResource ImgMenu}" />
        <Setter Property="IconSize" Value="32" />
        <Setter Property="IconOpacity" Value="0.75" />
        <Setter Property="Padding" Value="8" />
        <Setter Property="FontSize" Value="9" />
        <Setter Property="FontFamily" Value="Segoe UI" />
        <Setter Property="FontWeight" Value="SemiBold" />
        <Setter Property="Template">
            <Setter.Value>

                <ControlTemplate TargetType="local:TouchMenu">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" x:Name="root" >
                        <Grid>
                            <Border BorderBrush="{TemplateBinding Foreground}" x:Name="BtnExpand" Padding="{TemplateBinding Padding}">
                                <StackPanel VerticalAlignment="Top">
                                    <TextBlock Text="{TemplateBinding Text}" 
                                               HorizontalAlignment="Center"
                                               Margin="0 0 0 2"
                                               Visibility="{TemplateBinding TextVisibility}"
                                               Foreground="{TemplateBinding Foreground}"
                                               FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" 
                                               FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}"/>
                                    <Image Source="{TemplateBinding Icon}" Width="{TemplateBinding IconSize}" Height="{TemplateBinding IconSize}" RenderOptions.BitmapScalingMode="HighQuality" />
                                </StackPanel>
                            </Border>
                        </Grid>

                    </Border>
                    <ControlTemplate.Triggers>
                        <!--<Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter Property="RenderDefaulted" TargetName="Chrome" Value="true"/>
                        </Trigger>-->
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" TargetName="root" Value="0.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type local:TouchMenuItem}">
        <Setter Property="FontWeight" Value="SemiBold" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="FontFamily" Value="Segoe UI" />
        <Setter Property="Background" Value="AliceBlue" />
        <Setter Property="Foreground" Value="Black" />
        <Setter Property="CornerRadius" Value="2" />
        <Setter Property="BorderBrush" Value="AliceBlue" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="UseLayoutRounding" Value="True" />
        <Setter Property="Template">
            <Setter.Value>

                <ControlTemplate TargetType="local:TouchMenuItem">
                    <Border  x:Name="root" >
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup  x:Name="SelectionStates">
                                <VisualStateGroup.Transitions>
                                    <!--<VisualTransition GeneratedDuration="0:0:0.15" />-->
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Active">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ItemButton" Duration="00:00:00.200" Storyboard.TargetProperty="Opacity" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Children">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ItemButton" Duration="00:00:00.200" Storyboard.TargetProperty="Opacity" To="0.90" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Inactive">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ItemButton" Duration="00:00:00.200" Storyboard.TargetProperty="Opacity" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Hovered">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ItemButton" Duration="00:00:00.200" Storyboard.TargetProperty="Opacity" To="1" />
                                        <ColorAnimation Storyboard.TargetName="ItemButton" Duration="00:00:00.200" Storyboard.TargetProperty="(Control.BorderBrush).(SolidColorBrush.Color)" To="White" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InactiveParent">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ItemButton" Duration="00:00:00.200" Storyboard.TargetProperty="Opacity" To="0.25" />
                                        <DoubleAnimation Storyboard.TargetName="LineCanvas" Duration="0:0:0.6" Storyboard.TargetProperty="Opacity" To="0.25" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="HoveredParent">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ItemButton" Duration="00:00:00.200" Storyboard.TargetProperty="Opacity" To="0.75" />
                                        <DoubleAnimation Storyboard.TargetName="LineCanvas" Duration="0:0:0.6" Storyboard.TargetProperty="Opacity" To="0.4" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup  x:Name="HasItemsStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.2" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="HasItems"/>
                                <VisualState x:Name="NoItems"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpansionStates">
                                <!--<VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.2" />
                                </VisualStateGroup.Transitions>-->
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ItemsHost" Duration="0:0:0.3" Storyboard.TargetProperty="Opacity" From="0" To="1" />
                                        <DoubleAnimation Storyboard.TargetName="LineCanvas" Duration="0:0:0.3" Storyboard.TargetProperty="Opacity" From="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ItemsHost" Duration="0:0:0.2" Storyboard.TargetProperty="Opacity" From="1" To="0" />
                                        <DoubleAnimation Storyboard.TargetName="LineCanvas" Duration="0:0:0.2" Storyboard.TargetProperty="Opacity" To="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Canvas x:Name="MenuContainer" Width="1" Height="1">

                            <Canvas x:Name="LineCanvas" Width="1" Height="1" Opacity="0.6" Visibility="{Binding Visibility, ElementName=ItemsHost}" />
                            <Button x:Name="ItemButton" 
                                    Content="{TemplateBinding Header}" 
                                    Command="{TemplateBinding Command}"
                                    CommandParameter="{TemplateBinding CommandParameter}"
                                    Width="{TemplateBinding MenuTileSize}" 
                                    Height="{TemplateBinding MenuTileSize}" 
                                    FontWeight="{TemplateBinding FontWeight}"
                                    FontSize="{TemplateBinding FontSize}"
                                    FontFamily="{TemplateBinding FontFamily}"
                                    FontStretch="{TemplateBinding FontStretch}"
                                    FontStyle="{TemplateBinding FontStyle}"
                                    Foreground="{TemplateBinding Foreground}"
                                    Template="{TemplateBinding ItemButtonTemplate}"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}">
                            </Button>

                            <ItemsPresenter x:Name="ItemsHost" Visibility="Collapsed"/>

                        </Canvas>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <local:TouchMenuPanel x:Name="pnlItems" />
                    <!--<StackPanel x:Name="pnlItems" Background="Transparent"></StackPanel>-->
                    <!--<local:TouchMenuRadialPanel LineCanvas="{Binding ElementName=grdPanel, Path=Children[0]}" 
                                        x:Name="pnlItems" Background="Transparent"
                                      ExpandedState="{Binding ElementName=Expanded}"
                                        CollapsedState="{Binding ElementName=Collapsed}"/>-->
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>

        <!--<Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <local:TouchMenuItem />
                </DataTemplate>
            </Setter.Value>
        </Setter>-->

        <Setter Property="ItemButtonTemplate">

            <Setter.Value>
                <ControlTemplate TargetType="ButtonBase">
                    <Border 
                            SnapsToDevicePixels="True"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TouchMenuItem}}}"
                            >
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="11" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Rectangle Margin="3 3 3 0" Width="5" Height="5" Fill="{TemplateBinding Foreground}" 
                                VerticalAlignment="Top" 
                                
                                Visibility="{Binding Path=HasItemsVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TouchMenuItem}}}" />
                            <ContentPresenter x:Name="Content" Grid.Column="1" />
                            <!--<TextBlock Grid.Column="1"
                                FontWeight="Bold"
                                FontSize="14"
                                TextWrapping="Wrap"
                                Text="{Binding Path=Header, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TouchMenuItem}}}" />-->

                            <Image Grid.Row="1" Grid.Column="1" Stretch="Uniform" Source="{Binding Path=Icon, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TouchMenuItem}}}" MaxWidth="32" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="2" RenderOptions.BitmapScalingMode="HighQuality" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:TouchPivot">

        <Setter Property="FontFamily" Value="Segoe UI" />
        <Setter Property="Foreground" Value="White" />
        <!--<Setter Property="Background" Value="Transparent" />-->

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:TouchPivot">
                    <Grid Name="LayoutRoot" Background="{TemplateBinding Background}" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid ClipToBounds="true" Margin="3 3 3 8" x:Name="HeadersContainer" Height="{TemplateBinding HeaderHeight}"  Background="Transparent" IsManipulationEnabled="true">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <ContentControl ClipToBounds="True">
                                    <Canvas x:Name="HeadersPanelHost">
                                        <Canvas.RenderTransform>
                                            <TranslateTransform x:Name="HeadersTranslate" />
                                        </Canvas.RenderTransform>
                                    </Canvas>
                                </ContentControl>
                                <ContentControl Grid.Column="1" Content="{TemplateBinding HeaderPlaceholder}" />
                            </Grid>
                        </Grid>
                        <Grid x:Name="ItemsWrapper" Grid.Row="1" ClipToBounds="true" Background="Transparent">
                            <Canvas x:Name="ItemsPanelHost" IsItemsHost="true">
                                <Canvas.RenderTransform>
                                    <TranslateTransform x:Name="ItemsTranslate" />
                                </Canvas.RenderTransform>
                            </Canvas>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:PivotHeader">
        <Setter Property="FontSize" Value="{Binding Path=TitleSize, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TouchPivot}}}" />
        <Setter Property="FontFamily" Value="{Binding Path=FontFamily, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TouchPivot}}}" />
        <Setter Property="Foreground" Value="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TouchPivot}}}" />
        <!--<Setter Property="Margin" Value="0,0,10,0" />-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:PivotHeader">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PivotHeaderContent" Duration="00:00:00.400" Storyboard.TargetProperty="Opacity" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PivotHeaderContent" Duration="00:00:00.400" Storyboard.TargetProperty="Opacity" To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Inactive">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PivotHeaderContent" Duration="00:00:00.400" Storyboard.TargetProperty="Opacity" From="0" To="0.5" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <ContentPresenter x:Name="PivotHeaderContent" Margin="0 0 40 0" Opacity="0" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--
  Style : local:PivotItem
  File : Pivot\PivotItem.xaml
-->
    <Style TargetType="local:PivotItem">
        <Setter Property="Width" Value="460" />
        <Setter Property="FontFamily" Value="Segoe UI" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="CacheMode" Value="BitmapCache" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:PivotItem">
                    <Grid>
                        <Grid.RenderTransform>
                            <TranslateTransform x:Name="ItemContentTranslate" />
                        </Grid.RenderTransform>
                        <ContentPresenter x:Name="PivotItemContent" Visibility="Collapsed">

                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:TouchListBox">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalOnly"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="true">
                        <local:TouchScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </local:TouchScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ListBoxItem}">
                    <Setter Property="Background" Value="Transparent"/>
                    <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                    <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                    <Setter Property="Padding" Value="2,0,0,0"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                </Border>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsSelected" Value="true">
                                        <Setter Property="Background" TargetName="Bd" Value="#33FFFFFF"/>
                                        <!--<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>-->
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="IsSelected" Value="true"/>
                                            <Condition Property="Selector.IsSelectionActive" Value="false"/>
                                        </MultiTrigger.Conditions>
                                        <Setter Property="Background" TargetName="Bd" Value="#33FFFFFF"/>
                                        <!--<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>-->
                                    </MultiTrigger>
                                    <Trigger Property="IsEnabled" Value="false">
                                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>

    </Style>

    <Style TargetType="local:NetworkTreeNode">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:NetworkTreeNode">
                    <Grid>
                        <Border 
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{TemplateBinding CornerRadius}"
                        Padding="{TemplateBinding Padding}">
                            <local:NetworkTreeExpanderButton>
                                <local:NetworkTreeExpanderButton.Template>
                                    <ControlTemplate>
                                        <StackPanel>
                                            <Image Source="{Binding Icon}" HorizontalAlignment="Center" />
                                            <TextBlock Text="{Binding Label}" HorizontalAlignment="Center" />
                                        </StackPanel>
                                    </ControlTemplate>
                                </local:NetworkTreeExpanderButton.Template>

                            </local:NetworkTreeExpanderButton>
                        </Border>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:NetworkTree">
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="BorderBrush" Value="Gray" />
        <Setter Property="Background" Value="LightGray" />
        <Setter Property="LineThickness" Value="3" />
        <Setter Property="CornerRadius" Value="5" />
        <Setter Property="Padding" Value="5" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:NetworkTree">
                    <Border x:Name="root" BorderThickness="3">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup  x:Name="HasItemsStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.5" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="HasItems"/>
                                <VisualState x:Name="NoItems"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpansionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.5" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <!--<DoubleAnimation From="0" To="1" Duration="00:00:00.300" Storyboard.TargetName="pnlItems" Storyboard.TargetProperty="Zoom"/>-->
                                        <!--<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="txtLabel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
                                        </ObjectAnimationUsingKeyFrames>-->
                                        <!--<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="cnvLine" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                                        </ObjectAnimationUsingKeyFrames>-->
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <!--<DoubleAnimation From="1" To="0" Duration="00:00:00.300" Storyboard.TargetName="pnlItems" Storyboard.TargetProperty="Zoom"/>-->
                                        <!--<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="txtLabel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
                                        </ObjectAnimationUsingKeyFrames>-->
                                        <!--<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="cnvLine" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
                                        </ObjectAnimationUsingKeyFrames>-->
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <StackPanel VerticalAlignment="Center">
                            <Grid Background="Transparent" ClipToBounds="false">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                                <Grid Grid.Column="1" x:Name="grdPanel" Visibility="Collapsed" ClipToBounds="false">
                                <Canvas Width="1" Height="1" VerticalAlignment="Top" HorizontalAlignment="Left" x:Name="cnvLine" />
                                <ItemsPresenter x:Name="ItemsHost" />
                            </Grid>
                            <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
                                <local:NetworkTreeNode Content="{Binding}"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="{TemplateBinding CornerRadius}"
                                    Padding="{TemplateBinding Padding}"
                                    FontFamily="{TemplateBinding FontFamily}"
                                    FontSize="{TemplateBinding FontSize}"
                                    FontWeight="{TemplateBinding FontWeight}"
                                    FontStyle="{TemplateBinding FontStyle}"
                                    FontStretch="{TemplateBinding FontStretch}"
                                    Template="{TemplateBinding NodeContentTemplate}"
                                                       />
                                <!--<ContentPresenter x:Name="NetworkTreeContent"    ContentTemplate="{TemplateBinding NodeContentTemplate}" />-->
                            </StackPanel>
                        </Grid>
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <!--<StackPanel VerticalAlignment="Center"/>-->
                    <local:NetworkPanel HorizontalAlignment="Left" LineCanvas="{Binding ElementName=grdPanel, Path=Children[0]}" 
                                        x:Name="pnlItems"
                                      ExpandedState="{Binding ElementName=Expanded}"
                                        CollapsedState="{Binding ElementName=Collapsed}"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <local:NetworkTree ItemsSource="{Binding SubNodes}" 
                        NodeContentTemplate="{Binding Path=NodeContentTemplate, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:NetworkTree}}}" 
                                       />
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="NodeContentTemplate">
            <Setter.Value>
                <ControlTemplate TargetType="local:NetworkTreeNode">
                    <Grid>
                        <Border 
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{TemplateBinding CornerRadius}"
                        Padding="{TemplateBinding Padding}">
                            <local:NetworkTreeExpanderButton>
                                <local:NetworkTreeExpanderButton.Template>
                                    <ControlTemplate>
                                        <StackPanel>
                                            <Image Source="{Binding Icon}" HorizontalAlignment="Center" />
                                            <TextBlock Text="{Binding Label}" HorizontalAlignment="Center" />
                                        </StackPanel>
                                    </ControlTemplate>
                                </local:NetworkTreeExpanderButton.Template>

                            </local:NetworkTreeExpanderButton>
                        </Border>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="{x:Type local:Tile}">
        <Setter Property="Background" Value="#81007F"/>
        <!-- #81007F -->
        <Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Padding" Value="6"/>
        <Setter Property="Width" Value="96"/>
        <Setter Property="Height" Value="96"/>
        <Setter Property="Margin" Value="0 0 4 4"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:Tile}">
                    <Border x:Name="Wrapper"  Background="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <Grid Margin="{TemplateBinding Padding}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <TextBlock x:Name="Content" Text="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding TextAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Top" TextWrapping="Wrap" />
                            <Image Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Source="{TemplateBinding Icon}" MaxWidth="{TemplateBinding IconSize}" MaxHeight="{TemplateBinding IconSize}" Stretch="Uniform" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <!--<Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter Property="RenderDefaulted" TargetName="Chrome" Value="true"/>
                        </Trigger>-->
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Opacity" TargetName="Wrapper" Value="0.5"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" TargetName="Wrapper" Value="0.25"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>
